﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using DAL;

namespace FCTC_Web.Models
{
    public class Team:EntityBase
    {
        public static List<Team> GetQualifiedTeam()
        {
            return CH.GetAllData<Team>(i => i.SessionStatus == "参赛中"); ;
        }

        [Display(Name = "队伍名称"), Required(ErrorMessage = "请填写队伍的名称")]
        [MaxLength(50)]
        public string FullName { get; set; }

        [Display(Name = "队伍联系人"), Required(ErrorMessage = "请填写队伍的联系人")]
        [MaxLength(50)]
        public string TeamContactor { get; set; }

        [Display(Name = "队伍类型")]
        public string TeamType { get; set; }

        [Display(Name = "队伍状态"), Required(ErrorMessage = "请填写队伍的名称")]
        public string SessionStatus { get; set; }

        [DataType(DataType.Text), Required(ErrorMessage = "请填写联系电话"),Display(Name = "联系人电话"), MaxLength(30), RegularExpression(@"(13[0-9]{9}|18[0-9]{9}|15[0-9]{9})|(^(\d{3,4}-)?\d{7,8})$", ErrorMessage = "请填写正确的联系电话")]
        public string ContactNumber { get; set; }

        [Display(Name = "参赛口号")]
        [MaxLength(200)]
        public string Motto { get; set; }

        public virtual List<TeamMember> Members { get; set; }

        public virtual List<SessionUnit> SessionUnits { get; set; }

    }
}